#include "threadPool.h"
// 用于存储conf配置信息的结构体

// 读取conf配置文件
void load_config(FTP_CONFIG* config, const char* filename) {
    char line[1024], key[64], value[1024];
    FILE* fp;
    fp = fopen(filename, "r");
    if (fp == NULL) {
        fprintf(stderr, "Error: Failed to open config file %s\n", filename);
        exit(1);
    }

    while (fgets(line, sizeof(line), fp) != NULL) {
        if (line[0] == '#' || line[0] == '\n') {
            continue;   // 忽略注释行和空行
        }
        if (sscanf(line, "%s %s", key, value) != 2) {
            continue;   // 忽略格式不正确的行
        }

        if (strcmp(key, "sever_port") == 0) {
            strncpy(config->sever_port, value, sizeof(config->sever_port));
        }
        else if (strcmp(key, "sever_addr") == 0) {
            strncpy(config->sever_addr, value, sizeof(config->sever_addr));
        }
        else {
            fprintf(stderr, "Warning: Unrecognized config key '%s'\n", key);
        }
    }

    fclose(fp);
}

// 使用conf配置信息

